﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using System.Web.UI.HtmlControls;
using System.Configuration;
using CommonTagTime;
using System.Resources;
using System.Web.Security;

public class BasePage : System.Web.UI.Page
{
    public BasePage()
    {
        //
        // TODO: Add constructor logic here
        //
    }

    //protected override void Render(System.Web.UI.HtmlTextWriter writer)
    //{
    //    StringWriter Html = new StringWriter();
    //    HtmlTextWriter Render = new HtmlTextWriter(Html);
    //    base.Render(Render);
    //    writer.Write(Html.ToString().Replace("name=\"ctl00$content$", "name=\"").Replace("id=\"ctl00_content_", "id=\""));
    //}
    
    protected string ShowPicture(object Location, bool bThumbnail)
    {
        string str = string.Empty;
        if (Location != null && Location.ToString() != string.Empty)
        {
            str = string.Format(@"{0}{1}", bThumbnail ? ConfigurationManager.AppSettings["PictureImage_Thumbnail"] : ConfigurationManager.AppSettings["PictureImage"], Location);
        }
        return str;
    }

    public string ShowProductImage(object Location, bool bThumbnail)
    {
        string str = string.Empty;
        if (Location != null && Location.ToString() != string.Empty)
        {
            str = string.Format(@"{0}{1}", bThumbnail ? ConfigurationManager.AppSettings["ProductImage_Thumbnail"] : ConfigurationManager.AppSettings["ProductImage"], Location);
        }
        return str;
    }

    protected string ShowBlogImage(object Image1)
    {
        string str = string.Empty;
        if (Image1 != null && Image1.ToString() != string.Empty)
        {
            str = string.Format(@"<img src=""{0}{1}"" alt="""" />", ConfigurationManager.AppSettings["BlogImage_Thumbnail"], Image1);
        }
        return str;
    }

    protected string ShowServiceImage(object Image1)
    {
        string str = string.Empty;
        if (Image1 != null && Image1.ToString() != string.Empty)
        {
            str = string.Format(@"<img src=""{0}{1}"" alt="""" />", ConfigurationManager.AppSettings["ServiceImage_Thumbnail"], Image1);
        }
        return str;
    }

    protected string ShowPartnerImage(object Image1, object BriefContent)
    {
        string str = string.Empty;
        if (Image1 != null && Image1.ToString() != string.Empty)
        {
            str = string.Format(@"<img src=""{0}{1}"" title=""{2}"" alt=""{2}"" />", ConfigurationManager.AppSettings["PartnerImage_Thumbnail"], Image1, BriefContent.ToString());
        }
        return str;
    }

    public string ShowDay(object Dated)
    {
        string str = string.Empty;
        if (Dated != null && Dated.ToString() != string.Empty)
        {
            str = string.Format(@"{0:dd/MM/yyyy}", Dated);
        }

        return str;
    }

    public int GetCurrentPage()
    {
        int i = 1;
        i = clsCheck.QueryString("pg", enmDataType._Int) ? Convert.ToInt16(Request.QueryString["pg"]) : 1;

        if (i < 1)
            i = 1;

        return i;
    }

    public static string TagUrl(object Name)
    {
        string str = string.Empty;
        if (Name != null)
        {
            str = Name.ToString().Replace("-", "").Replace(":", "").Replace("%", "").Replace("?", "").Replace(",", "").Replace("\"", "").Replace("!", "").Replace("&", "");
            str = clsText.NoSign(str).ToLower().Replace("/", "-").Replace(" ", "-");
            str = str.Replace("--", "-");
        }
        return str;
    }
   

    #region Property
    
    #endregion
}
